package com.rwb.springboot.sell.cenverter;

import com.rwb.springboot.sell.dto.OrderDTO;
import com.rwb.springboot.sell.vo.OrderMaster;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ruwenbo on 2018/1/2.
 */
public class OrderMaster2OrderDTOConverter {

    public static OrderDTO converter(OrderMaster orderMaster) {
        OrderDTO orderDTO = new OrderDTO();
        BeanUtils.copyProperties(orderMaster, orderDTO);
        return orderDTO;
    }

    public static List<OrderDTO> converter(List<OrderMaster> orderMasters) {
        List<OrderDTO> orderDTOS = new ArrayList<OrderDTO>();
        for (OrderMaster orderMaster : orderMasters) {
            OrderDTO orderDTO = new OrderDTO();
            BeanUtils.copyProperties(orderMaster, orderDTO);

        }
        return orderDTOS;
    }
}
